﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucProduct.ascx.cs" Inherits="SES.CMS.AdminCP.PageUC.ucProduct" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dxpc" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function OnClientPasteHtml(sender, args) {
            var commandName = args.get_commandName();
            var value = args.get_value();
            if (commandName == "ImageManager") {
                //See if an img has an alt tag set
                var div = document.createElement("DIV");
                //Do not use div.innerHTML as in IE this would cause the image's src or the link's href to be converted to absolute path.
                //This is a severe IE quirk.
                Telerik.Web.UI.Editor.Utils.setElementInnerHtml(div, value);
                //Now check if there is alt attribute
                var img = div.firstChild;
                //alert(div.innerHTML);

                //Set new content to be pasted into the editor

                if (!!img.alt) {
                    var newInner = "<center>";
                    newInner = newInner + "<img src='" + img.src + "' alt='" + img.alt + "'/></center><center>";
                    newInner = newInner + img.alt + "</center>";

                    args.set_value(newInner);
                }
                else {
                    var newInner = "<center><img src='" + img.src + "' alt='Dang Viet jsc'/></center><br/>";

                    args.set_value(newInner);
                }

            }
        }
    </script>
</telerik:RadCodeBlock>
<style type="text/css">
    td.tdTitle
    {
        height: 20px;
        margin-left: 2px;
        width: 100px;
        font-family: Times New Roman, Arial, Tahoma;
        font-size: 15px;
        color: #000;
    }
    td.tdTitle p
    {
        height: 20px;
        margin: 0px;
        padding: 0px;
        color: #000;
        width: 120px;
    }
    td.tdContent
    {
    }
    .style1
    {
        width: 339px;
    }
</style>
<h2>
    Sản phẩm</h2>
<table width="100%" border="1">
    <tr>
        <td class="tdTitle">
            <p>
                Tên sản phẩm:</p>
        </td>
        <td class="style1">
            <asp:TextBox ID="txtTenSanPham" runat="server" Width="235px"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvTitle" runat="server" ErrorMessage="***" ControlToValidate="txtTenSanPham" ValidationGroup="submitGrp"></asp:RequiredFieldValidator>
        </td>
        <td class="tdTitle">
            <p>
                Mã sản phẩm:</p>
        </td>
        <td>
            <asp:TextBox ID="txtMaSanPham" runat="server" Width="235px"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td class="tdTitle">
            <p>
                Giá bán</p>
        </td>
        <td class="style1">
            <asp:TextBox ID="txtGia" runat="server" Width="235px"></asp:TextBox>
            <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtGia"
                ErrorMessage="***" MaximumValue="9999999999" MinimumValue="0" Type="Double"></asp:RangeValidator>
        </td>
        <td class="tdTitle">
            <p>
                Giảm giá</p>
        </td>
        <td>
            <asp:TextBox ID="txtGiamGia" runat="server" Width="235px"></asp:TextBox>
            <asp:RangeValidator ID="RangeValidator2" runat="server" ControlToValidate="txtGiamGia"
                ErrorMessage="Giá trị không đúng" MaximumValue="9999999999" MinimumValue="0"
                Type="Double"></asp:RangeValidator>
        </td>
    </tr>
    <tr>
        <td class="tdTitle">
            <p>
                Xuất xứ:</p>
        </td>
        <td class="style1">
            <asp:DropDownList ID="drpNhanHieu" runat="server" Width="135px" AppendDataBoundItems="true"
                Visible="false">
                <asp:ListItem Text=".: Không chọn :." Value="0"></asp:ListItem>
            </asp:DropDownList>
            <asp:DropDownList ID="ddlXuatXu" runat="server" Width="255px" AppendDataBoundItems="true">
                <asp:ListItem Text=".: Không chọn :." Value="0"></asp:ListItem>
            </asp:DropDownList>
        </td>
        <td class="tdTitle">
            <p>
                Sản phẩm nổi bật</p>
        </td>
        <td>
            <asp:CheckBox ID="cbSanPhamMoi" runat="server" />
        </td>
    </tr>
    <tr>
        <td class="tdTitle">
            <p>
                Loại sản phẩm:</p>
        </td>
        <td class="style1">
            <asp:DropDownList ID="drpLoaiSanPham" runat="server" Width="135px" AppendDataBoundItems="true">
                <asp:ListItem Text=".: Không chọn :." Value="0"></asp:ListItem>
            </asp:DropDownList>
            Đơn vị tính
            <asp:DropDownList ID="drpDonViTinh" runat="server" Width="116px" AppendDataBoundItems="true">
                <asp:ListItem Text=".: Không chọn :." Value="0"></asp:ListItem>
            </asp:DropDownList>
        </td>
        <td class="tdTitle">
            <p>
                Sản phẩm bán chạy</p>
        </td>
        <td>
            <asp:CheckBox ID="cbSanPhamBanChay" runat="server" />
        </td>
    </tr>
    <tr>
        <td class="tdTitle">
            Ảnh đại diện:
        </td>
        <td colspan="3">
            <asp:FileUpload ID="fulImage" runat="server" />
            <asp:HyperLink runat="server" Target="_blank" ID="hplImage" Text="[Xem ảnh]" Visible="false"></asp:HyperLink>
        </td>
    </tr>
    <tr>
        <td class="tdTitle">
            Thông tin khác:
        </td>
        <td colspan="3">
            <asp:TabContainer ID="tcDetail" runat="server" ActiveTabIndex="0" Width="100%">
                <asp:TabPanel ID="TabPanel1" runat="server" HeaderText="Mô tả">
                    <ContentTemplate>
                        <asp:TextBox ID="txtMota" Width="100%" Height="200px" runat="server" TextMode="MultiLine"></asp:TextBox>
                    </ContentTemplate>
                </asp:TabPanel>
                <asp:TabPanel ID="TabPanel3" runat="server" HeaderText="Mô tả chi tiết">
                    <ContentTemplate>
                        <CKEditor:CKEditorControl ID="txtMoTaChiTiet" runat="server" Visible="false"></CKEditor:CKEditorControl>
                        <telerik:RadEditor ID="txtDetail" runat="server" OnClientPasteHtml="OnClientPasteHtml"
                            DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd" Width="99%" Height="700px">
                            <ImageManager MaxUploadFileSize="1024000000" ViewMode="Grid" DeletePaths="~/Media/"
                                UploadPaths="~/Media/" ViewPaths="~/Media/"></ImageManager>
                        </telerik:RadEditor>
                    </ContentTemplate>
                </asp:TabPanel>
                <asp:TabPanel ID="TabPanel6" runat="server" HeaderText="Thông tin bảo hành">
                    <ContentTemplate>
                        <CKEditor:CKEditorControl ID="txtBaoHanh" runat="server" Visible="false"></CKEditor:CKEditorControl>
                        <telerik:RadEditor ID="txtBaoHanhTer" runat="server" OnClientPasteHtml="OnClientPasteHtml"
                            DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd" Width="99%" Height="700px">
                            <ImageManager MaxUploadFileSize="1024000000" ViewMode="Grid" DeletePaths="~/Media/"
                                UploadPaths="~/Media/" ViewPaths="~/Media/"></ImageManager>
                        </telerik:RadEditor>
                    </ContentTemplate>
                </asp:TabPanel>
                <asp:TabPanel ID="TabPanel4" Visible="true" runat="server" HeaderText="Từ khóa">
                    <ContentTemplate>
                        Tags:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
                        <asp:TextBox ID="txtTuKhoa" TextMode="MultiLine" runat="server" Width="50%"></asp:TextBox>
                    </ContentTemplate>
                </asp:TabPanel>
            </asp:TabContainer>
        </td>
    </tr>
    <tr>
        <td>Số thứ tự</td>
        <td>
                <asp:TextBox ID="txtOrderID" runat="server" Width="68px" Text="0" ValidationGroup="submitGrp"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtOrderID"
                ErrorMessage="*** Cần nhập số thứ tự" ValidationGroup="submitGrp"></asp:RequiredFieldValidator>
            <asp:RangeValidator ID="RangeValidator3" runat="server" ErrorMessage="Nhập số(Giá trị từ 0~1000)"
                ForeColor="Red" ControlToValidate="txtOrderID" Type="Integer" MinimumValue="0"
                MaximumValue="1000"></asp:RangeValidator>
        </td>
    </tr>
    <tr>
        <td class="tdTitle">
        </td>
        <td colspan="3">
        <asp:Button runat="server" ID="btnLuu" Text="Lưu" OnClick="btSave_Click" ValidationGroup="submitGrp"/>
         <asp:Button runat="server" ID="btnCancel" Text="Lưu" OnClick="btnCancel_Click"/>
         <a href="Default.aspx?Page=AddMultiImg" title="Thêm ảnh sản phẩm">Thêm ảnh cho sản phẩm </a>
        </td>
    </tr>
</table>
